import Base from 'models/base';
import SystemUtil from 'utils/systemUtil';

import moment from 'moment';

export default class SysNotice extends Base {
  constructor(notice) {
    super();

    this.key = SystemUtil.getId();
    this.id = notice.noticeTipId;
    this.title = notice.nitoceTitle;
    this.content = notice.noticeContent;
    this.isLook = notice.isLooked !== 0;

    let createTime = notice.createTime;
    this.createTime = moment(createTime).valueOf();

    let imgUrl = notice.noticeImgUrl;
    if (SystemUtil.isEmpty(imgUrl)) {
      imgUrl = '';
    }
    this.imgUrl = imgUrl;

    let tipUrl = notice.noticeTipUrl;
    if (SystemUtil.isEmpty(tipUrl)) {
      tipUrl = '';
    }
    this.tipUrl = tipUrl;
  }
}
